import { _decorator, Button, Collider2D, Color, Component, Contact2DType, Label, Node, Vec3, Animation, color } from 'cc';
import { BattleManager } from '../BattleManager';
import { EntityManager } from '../Base/EntityManager';
import { SkillStateMachine } from './SkillStateMachine';

import { Context } from '../Context';
import { EEvent, EGroup, EState, EntityType, PLAY_AREA, EAnimationPlayMode, EPlayerType, ESkill, ESkillType, EBuff, EColor, EWuxing, EWeather } from '../Config/Enum';
import { Core } from '../Core/Core';
import { EnemyStateMachine } from '../EnemyStateMachine';
import { EnemyManager } from '../EnemyManager';
import ObjectPoolManager from '../Core/ObjectPoolManager';
import { Skill } from './Skill';
import { NumberText } from '../Core/NumberText';
import { PlayerData } from '../PlayerData';

import { buffConfig } from '../Config/SkillConfig';
import { PlayerManager } from '../PlayerManager';
import { Util } from '../Util';
import { wuxingEnhance } from '../Config/Config';
import { Buff } from '../BuffManager';
import { EAffixType } from '../Item/Item';
import { WallManager } from '../WallManager';
const { ccclass, property } = _decorator;

@ccclass('SkillManager')
export class SkillManager extends EntityManager {

    private _speedFactor: number = 1; // 添加速度因子
    // 武学属性
    skill: Skill;
    isMoving = false;
    scale = 0;
    cd = 1;
    originalCD = 1;
    playSpeed = 1; // 播放速度

    runeId = 0; // 符文ID
    moveSpeed = 10;
    attackSpeed = 100;
    duration: number;
    level = 1;
    type: ESkill;
    skillType: ESkillType;
    slashColor: Color;
    animationPlayMode: EAnimationPlayMode = EAnimationPlayMode.Normal;

    wuxing: string;
    effectDuration = 0; // buff持续时间
    effectChance = 0; // buff触发几率
    buffTypeList: EBuff[] = [];
    buffType: EBuff;
    buffDuration: number = 1; // buff持续时间

    damage = 0;
    ap = 0; // 攻击力
    buffAp = 0; // buff攻击力
    criticalChance = 0; // 暴击几率
    penetrateCount = 0; // 穿透数量
    penetratePercent = 0; // 穿透百分比

    // 玩家属性
    playerType: EPlayerType;
    playerData: PlayerData;
    pm: PlayerManager;
    em: EnemyManager;

    isInvincible = false;
    isCollided = false;
    isCritical = false;
    isEffect = false;
    isIngoreDp: boolean;


    direction: Vec3 = new Vec3();
    _lifeTimer = 0; // 生命周期计时器
    isHit: boolean = true;
    // 伤害相关
    isTrueDamage: boolean = false;
    ignoreDefenseRatio = 0; // 无视防御比例 (0-1)
    damageMultiplier = 1;   // 伤害倍数
    wuxingAffixes:{}
    wm: WallManager



    init(type: ESkill, pm: PlayerManager) {

            // 添加：获取当前游戏速度因子
    if (BattleManager.Instance) {
        this.setSpeedFactor(BattleManager.Instance.getCurrentSpeed());
    }


        //console.log("SkillManager init direction1", this.direction);
        this.pm = pm;
        //this.wuxing_affixes = pm.wuxing_affixes;

        this.skill = pm.skills.get(type);

        this.node.setScale(this.skill.scale[0], this.skill.scale[1]);

        this.attackSpeed = pm.attackSpeed;
        this.wuxing = pm.wuxing;

        this.animationPlayMode = this.skill.animationPlayMode;
        this.type = type;
        this.ap = this.skill.ap;
        this.buffAp = this.skill.buffAp;
        this.effectChance = this.skill.effectChance;
        this.effectDuration = this.skill.effectDuration;
        this.moveSpeed = this.skill.moveSpeed;
        this._lifeTimer = this.skill.duration; // 武学播放时间
        this.skillType = this.skill.skillType;
        this.slashColor = this.skill.slashColor;
        this.cd = this.skill.cd;
        this.level = this.skill.level;
        this.buffType = this.skill.buffType;
        this.damage = this.skill.damage;
        this.runeId = this.skill.runeId;
        this.playSpeed = this.skill.playSpeed;
        this.criticalChance = this.skill.criticalChance;
        this.penetrateCount = this.pm.penetrateCount;
        // this.buffTypeList = this.skill.buffTypeList || [];
        // this.buffDuration = this.skill.buffDuration || this.effectDuration;
        this.penetratePercent = this.pm.penetratePercent
        this.wuxingAffixes = this.pm.wuxingAffixes;

        if (!this.skill) {
            return;
        }


        if (this.node.getComponent(SkillStateMachine)) {
            this.fsm.init(type, this.playSpeed, this.animationPlayMode);
            this.state = EState.Idle;
        } else {
            this.fsm = this.node.addComponent(SkillStateMachine);
            this.fsm.init(type, this.playSpeed, this.animationPlayMode);
            this.state = EState.Idle;
        }
        this.reset()

        this.wm = BattleManager.Instance.wm;


    }

    // 门派三个武学之外的武学
    initOtherSkill(type: ESkill, pm: PlayerManager) {
        console.log("SkillManager initOtherSkill")

            // 添加：获取当前游戏速度因子
    if (BattleManager.Instance) {
        this.setSpeedFactor(BattleManager.Instance.getCurrentSpeed());
    }


        this.pm = pm

        if (this.node.getComponent(SkillStateMachine)) {
            this.fsm.init(type, this.playSpeed, this.animationPlayMode);
            this.state = EState.Idle;
        } else {
            this.fsm = this.node.addComponent(SkillStateMachine);
            this.fsm.init(type, this.playSpeed, this.animationPlayMode);
            this.state = EState.Idle;
        }


        this.node.setScale(this.scale, this.scale);


        this.reset()


    }

    reset(){
        this.isTrueDamage = false
        this.ignoreDefenseRatio = 0;
        this.damageMultiplier = 1;
        this.isCritical = false
        this.isIngoreDp = false
    }

    protected onEnable(): void {
        let collider = this.node.getComponent(Collider2D);
        collider?.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
        collider?.on(Contact2DType.END_CONTACT, this.onEndContact, this);

        this.node.on("SkillAnimationFinished", this.onAnimationFinished, this);
    }

    protected onDisable(): void {
        let collider = this.node.getComponent(Collider2D);
        collider?.off(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
        collider?.off(Contact2DType.END_CONTACT, this.onEndContact, this);

        this.node.off("SkillAnimationFinished", this.onAnimationFinished, this);
    }

    start() {}

    update(dt: number) {
        // 应用速度因子
        const scaledDt = dt * this._speedFactor;

        this.move(scaledDt);

        // 处理固定duration的武学
        if (this.animationPlayMode == EAnimationPlayMode.LoopToEnd && this._lifeTimer > 0) {
            this._lifeTimer -= scaledDt;
            if (this._lifeTimer <= 0) {
                this.recycleSkill();
            }
        }
    }

    onAnimationFinished() {
        ObjectPoolManager.Instance.ret(this.node);
    }

    move(dt: number) {
        if (this.skillType === ESkillType.Forward) {
            if (
                this.node.worldPosition.x > Core.Instance.screenBounds.maxX || // 
                this.node.worldPosition.x < Core.Instance.screenBounds.minX || // 0
                this.node.worldPosition.y > Core.Instance.screenBounds.maxY || // 
                this.node.worldPosition.y < Core.Instance.screenBounds.minY // 0
            ) {
                ObjectPoolManager.Instance.ret(this.node);
                return;
            }
            if (this.direction && this.direction.length() > 0) {
                this.node.setPosition(
                    this.node.position.x + this.direction.x * this.moveSpeed * dt,
                    this.node.position.y + this.direction.y * this.moveSpeed * dt
                );
            }
        }
    }

    // 添加设置速度的方法
    setSpeedFactor(factor: number) {
        this._speedFactor = factor;
    }

    private setRotation() {
        // 计算方向的角度（从正右方开始，逆时针为正）
        const angleRad = Math.atan2(this.direction.y, this.direction.x);
        let angleDeg = angleRad * (180 / Math.PI);
        
        // 调整角度使默认朝上的图片面向目标方向
        angleDeg -= 90;
        
        // 设置节点旋转
        this.node.angle = angleDeg;
    }

    setDirection(direction: Vec3) {
        this.direction = direction;
        this.direction.normalize();
        this.setRotation();
    }

    levelUP() {
        this.level++;
        this.node.setScale(Math.abs(this.node.scale.x) + 0.01, this.node.scale.y + 0.01, 1);
        this.moveSpeed += 0.1;
    }

    public getLevel(): number {
        return this.level;
    }

    protected onBeginContact(self: Collider2D, other: Collider2D) {
        if (other.group === EGroup.ENEMY) {
            this.onHitEnemy(self,other);
        }
    }

    protected onHitEnemy(self,other: Collider2D,sureCritical=false) {
        this.em = other.node.getComponent(EnemyManager);
        if (!this.em) return;
        
        // 检查是否命中
        this.isHit = Math.random() < this.pm.accuracy - this.em.evasion;
        if (!this.isHit) {
            NumberText.show("未命中", this.node.worldPosition, Color.GRAY,0.5);
            return;
        }

        // 检查五行相克技能加成
        const wuxingMultiplier = this.calculateWuxingMultiplier(this.em.wuxing);
        
        // 计算伤害
        const damage = this.calculateDamage(this.em, wuxingMultiplier, sureCritical);
        
        // 应用伤害
        this.applyDamage(this.em, damage);
        
        // 尝试应用buff
        if(Math.random()<this.effectChance){
            this.applyBuffToEnemy(this.em, this.effectChance, this.buffType, this.buffAp, this.effectDuration);
        }

        
        // 回收武学
        // 当穿透数量剩余为0或者随机数小于穿透概率时回收武学
        if (this.penetrateCount <= 0 || Math.random()<this.penetratePercent) {
            this.handleSkillRecycle();
        } else {
            this.penetrateCount -= 1;
        }
    }

    private calculateWuxingMultiplier(enemyWuxing: string): number {
        if (Util.ELEMENT_ADVANTAGE_MAP[this.wuxing] === enemyWuxing) {
            return 1 + wuxingEnhance;
        } else if (Util.ELEMENT_ADVANTAGE_MAP[enemyWuxing] === this.wuxing) {
            return 1 - wuxingEnhance;
        }
        return 1.0;
    }

private calculateDamage(enemy: EnemyManager, wuxingMultiplier: number,sureCritical=false): number {
    // 计算实际生效的防御值（考虑无视防御比例）
    let effectiveDefense = 0
    if(this.isIngoreDp){
        effectiveDefense = 0
    } else{
        effectiveDefense = enemy.dp * (1 - this.ignoreDefenseRatio);
    }

    let damage = 0;

    // 基础伤害计算, 如果是真实伤害，则不考虑敌人防御
    if (this.isTrueDamage) {
        damage = this.damage;
    } else {
        // console.log("五行词缀伤害加成 damage-5:", damage); //0
        // console.log("五行词缀伤害加成 effectiveDefense:", effectiveDefense); //16.8
        // console.log("五行词缀伤害加成 (1 - effectiveDefense / (effectiveDefense + 100):",  (1 - effectiveDefense / (effectiveDefense + 100))); //0.8561643835616438
        // console.log("五行词缀伤害加成 this.damage:", this.damage); //16.8

                                
        // 使用调整后的防御值计算伤害
        damage = this.damage * (1 - effectiveDefense / (effectiveDefense + 100)); //NaN
        //console.log("五行词缀伤害加成 damage-4:", damage); //NaN
    }
    // 应用伤害倍数
    //console.log("五行词缀伤害加成 damage-3:", damage);
    damage *= this.damageMultiplier;
    //console.log("五行词缀伤害加成 damage-2:", damage);
    // 检查暴击
    if(sureCritical){
        this.isCritical=true
    }else{
        this.isCritical = Math.random() < this.criticalChance + this.pm.criticalChance;}
    if (this.isCritical) {
        damage *= this.pm.criticalDamage;
    }
    //console.log("五行词缀伤害加成 damage-1:", damage);
    // 应用五行加成
    damage = damage * wuxingMultiplier;
    //console.log("五行词缀伤害加成 damage0:", damage);
    // 检查五行词缀伤害加成
    let wuxingAffixMultiplier = this.checkWuxingAffixDamage()
    //console.log("五行词缀伤害加成 wuxingAffixMultiplier2:", wuxingAffixMultiplier);

    damage *= wuxingAffixMultiplier;
    //console.log("五行词缀伤害加成 damage3:", damage);

    // 检查易伤状态（增加30%伤害）
    if (enemy.isVulnerable) {
        damage *= 1.3;
    }
    
    // 加入小范围伤害浮动 (±5%)
    const damageVariation = 0.05;
    const randomFactor = 1 + (Math.random() * damageVariation * 2 - damageVariation);
    damage = Math.round(damage * randomFactor);

    return damage;
}

private applyDamage(enemy: EnemyManager, damage: number) {
    let damageColor = Color.WHITE;
    let scale = 1
    
    if (this.isTrueDamage) {
        damageColor = color().fromHEX(EColor.Purple);
        scale = 2
    } else if (this.isCritical) {
        damageColor = Color.YELLOW;
        scale = 2

    }
    
    enemy.hurt(damage, this.pm.playerType, damageColor,scale);
}

    protected applyBuffToEnemy(enemy: EnemyManager, effectChance, buffType, buffAp, buffDuration) {
        console.log("addbuff in applyBuffToEnemy:buffType",buffType, buffDuration)
        
        const isEffect = Math.random() < effectChance;
        if (!isEffect) return;
        

            const buffConfigData = buffConfig[buffType];
            if (!buffConfigData) {
                console.warn(`Buff type ${buffType} not found in config.`);
                return;
            }
            
            const buff = new Buff(
                buffConfigData.id,
                buffType,
                this.pm.playerType,
                buffDuration,
                buffAp,
                buffConfigData.color,
                buffConfigData.isDot,
                buffConfigData.isPercentage
            );
            
            // 使用新的Buff系统
            enemy.buffManager.addBuff(buff);
        
    }

    private handleSkillRecycle() {
        if (this.animationPlayMode === EAnimationPlayMode.Loop) {
            this.recycleSkill();
        }
    }

    private recycleSkill() {
        this._lifeTimer = 0;
        ObjectPoolManager.Instance.ret(this.node);
    }

    protected onEndContact(self: Collider2D, other: Collider2D) {}

    attack() {
        this.state = EState.Attack;
    }

    autoAttack() {
        this.state = EState.Attack;
    }

    // 检查五行词缀伤害加成
    checkWuxingAffixDamage(): number {
        console.log("五行词缀生效啊checkWuxingAffixDamage this.wuxingAffixes:", this.wuxingAffixes);
        // console.log("五行词缀生效啊checkWuxingAffixDamage this.wuxingAffixes.length:", this.wuxingAffixes.length);
        let multiplier = 1.0;

        //const length = Object.keys(this.wuxingAffixes).length;
    // // 获取所有词缀键值对
    // const affixEntries = Object.entries(this.wuxingAffixes);


    // 遍历对象的所有属性
    for (const key in this.wuxingAffixes) {
        if (this.wuxingAffixes.hasOwnProperty(key)) {
            console.log("五行词缀生效啊 key:", key);
            console.log("五行词缀生效啊 value:", this.wuxingAffixes[key]);


            
            // 这里可以根据你的业务逻辑处理每个词缀
            // 例如：multiplier += this.wuxingAffixes[key];
            multiplier = this.processSingleAffix(key as EAffixType, this.wuxingAffixes[key], multiplier);
            //console.log("五行词缀伤害加成 wuxingAffixMultiplier1:", multiplier);
        }
    }
        return multiplier;
        
        


    }


    private processSingleAffix(affixType: EAffixType, affixValue: number, currentMultiplier: number): number {
        let multiplier = currentMultiplier;
    
        switch(affixType) {
            // ==================== 金系词缀 ====================
            case EAffixType.Jin_DamageToKnockback:
                if (this.em && this.em.isKnockBacked) {
                    multiplier += affixValue;
                    console.log("金系词缀生效：对击退目标伤害加深", affixValue);
                }
                break;
                
            case EAffixType.Jin_DamageToWoodEnemy:
                if (this.em && this.em.wuxing === EWuxing.Mu) {
                    multiplier += affixValue;
                    console.log("金系词缀生效：对木系敌寇伤害加成", affixValue);
                }
                break;
                
            case EAffixType.Jin_FogDaySkillDamage:
                if (BattleManager.Instance.weather === EWeather.Foggy) {
                    multiplier += affixValue;
                    console.log("金系词缀生效：雾天武学伤害加成", affixValue);
                }
                break;
                
            // ==================== 木系词缀 ====================
            case EAffixType.Mu_DamageToPoisoned:
                if (this.em && this.em.isPoisoned) {
                    multiplier += affixValue;
                    console.log("木系词缀生效：对中毒目标伤害加深", affixValue);
                }
                break;
                
            case EAffixType.Mu_DamageToEarthEnemy:
                if (this.em && this.em.wuxing === EWuxing.Tu) {
                    multiplier += affixValue;
                    console.log("木系词缀生效：对土系敌寇伤害加成", affixValue);
                }
                break;
            case EAffixType.Mu_CloudyDaySkillDamage:
                if (BattleManager.Instance.weather === EWeather.Cloudy) {
                    multiplier += affixValue;
                    console.log("木系词缀生效：阴天武学伤害加成", affixValue);
                }
                break;
                
            // ==================== 水系词缀 ====================
            case EAffixType.Shui_DamageToSlowed:
                if (this.em && this.em.isSlowed) {
                    multiplier += affixValue;
                    console.log("水系词缀生效：对减速目标伤害加深", affixValue);
                }
                break;
                
            case EAffixType.Shui_DamageToFireEnemy:
                if (this.em && this.em.wuxing === EWuxing.Huo) {
                    multiplier += affixValue;
                    console.log("水系词缀生效：对火系敌寇伤害加成", affixValue);
                }
                break;

            case EAffixType.Shui_RainDaySkillDamage:
                if (BattleManager.Instance.weather === EWeather.Rainy) {
                    
                    multiplier += affixValue;
                    console.log("水系词缀生效：雨天武学伤害加成", affixValue);
                }
                break;

            // ==================== 土系词缀 ====================
            case EAffixType.Tu_DamageToStunned:
                if (this.em && this.em.isStuned) {
                    
                    multiplier += affixValue;
                    console.log("土系词缀生效：对眩晕目标伤害加深", affixValue);
                }
                break;
            case EAffixType.Tu_DamageToWaterEnemy:
                if (this.em && this.em.wuxing === EWuxing.Shui) {
                    
                    multiplier += affixValue;
                    console.log("土系词缀生效：对水系敌寇伤害加成", affixValue);

                }
                break;
            case EAffixType.Tu_WindDaySkillDamage:
                if (BattleManager.Instance.weather === EWeather.Windy) {

                    multiplier += affixValue;
                    console.log("土系词缀生效：雪天武学伤害加成", affixValue);
                }
                break;
            // ==================== 通用词缀 ====================
            // case EAffixType.DamageIncrease25Agility:

            //     multiplier += affixValue;
            //     console.log("通用词缀生效：增加敏捷伤害", affixValue);
            //     break;
                
            // case EAffixType.DamageIncrease25Strength:
            //     multiplier += affixValue;
            //     console.log("通用词缀生效：增加力量伤害", affixValue);
            //     break;
                
            // case EAffixType.DamageIncreaseToCCTarget:
            //     if (this.em && this.isEnemyUnderControl(this.em)) {
            //         multiplier += affixValue;
            //         console.log("通用词缀生效：对控制目标伤害加深", affixValue);
            //     }
            //     break;
                
            case EAffixType.WallHPFullAttack:
                if (this.wm && this.wm.getHpPercent() === 1) {
                    multiplier += affixValue;
                    console.log("通用词缀生效：对精英伤害加成", affixValue);
                }
                break;
            case EAffixType.DamageIncreaseToElite:
                if (this.em && this.em.isElite) {
                    multiplier += affixValue;
                    console.log("通用词缀生效：对精英伤害加成", affixValue);
                }
                break;
            case EAffixType.DamageIncreaseToGeneral:
                if (this.em && this.em.isBoss) {
                    multiplier += affixValue;
                    console.log("通用词缀生效：对普通敌寇伤害加成", affixValue);
                }
                break;
            case EAffixType.DamageIncreaseToSoldier:
                if (this.em && !this.em.isBoss && !this.em.isElite) {
                    multiplier += affixValue;
                    console.log("通用词缀生效：对士兵伤害加成", affixValue);
                }
                break;
            case EAffixType.DamageIncreaseToHighHP:
                if (this.em && this.em.getHPPercent() > 0.75) {
                    multiplier += affixValue;
                    console.log("通用词缀生效：对高血量目标伤害加深", affixValue);
                    
                }
                break;
            case EAffixType.DamageIncreaseToLowHP:
                if (this.em && this.em.getHPPercent() < 0.25) {
                    multiplier += affixValue;
                    console.log("通用词缀生效：对低血量目标伤害加深", affixValue);
                }
                break;
            case EAffixType.DamageIncreaseToCCTarget:
                if (this.em && this.em.buffManager.buffs.length > 0) {
                    multiplier += affixValue;
                    console.log("通用词缀生效：对控制目标伤害加深", affixValue);
                    
                }
                break;
                
            // 可以继续添加其他词缀...
                
            default:
                // // 对于没有特殊条件的词缀，直接累加
                // multiplier += affixValue;
                // console.log("默认词缀生效:", affixType, affixValue);
                break;
        }
    
    return multiplier;
}



        // // 金系词缀
        // { type: EAffixType.Jin_DamageToKnockback, minValue: 0.15, maxValue: 0.3, isPercentage: true, weight: 8, rarity: 2, groups: [EAffixGroup.Universal], wuxing: EWuxing.Jin },
        // { type: EAffixType.Jin_DamageToWoodEnemy, minValue: 0.05, maxValue: 0.1, isPercentage: true, weight: 6, rarity: 2, groups: [EAffixGroup.Universal], wuxing: EWuxing.Jin },
        // { type: EAffixType.Jin_FogDaySkillDamage, minValue: 0.1, maxValue: 0.15, isPercentage: true, weight: 5, rarity: 3, groups: [EAffixGroup.Universal], wuxing: EWuxing.Jin },
    
        // // 木系词缀
        // { type: EAffixType.Mu_DamageToPoisoned, minValue: 0.15, maxValue: 0.3, isPercentage: true, weight: 8, rarity: 2, groups: [EAffixGroup.Universal], wuxing: EWuxing.Mu },
        // { type: EAffixType.Mu_DamageToEarthEnemy, minValue: 0.05, maxValue: 0.1, isPercentage: true, weight: 6, rarity: 2, groups: [EAffixGroup.Universal], wuxing: EWuxing.Mu },
        // { type: EAffixType.Mu_CloudyDaySkillDamage, minValue: 0.1, maxValue: 0.15, isPercentage: true, weight: 5, rarity: 3, groups: [EAffixGroup.Universal], wuxing: EWuxing.Mu },
    
        // // 水系词缀
        // { type: EAffixType.Shui_DamageToSlowed, minValue: 0.15, maxValue: 0.3, isPercentage: true, weight: 8, rarity: 2, groups: [EAffixGroup.Universal], wuxing: EWuxing.Shui },
        // { type: EAffixType.Shui_DamageToFireEnemy, minValue: 0.05, maxValue: 0.1, isPercentage: true, weight: 6, rarity: 2, groups: [EAffixGroup.Universal], wuxing: EWuxing.Shui },
        // { type: EAffixType.Shui_RainDaySkillDamage, minValue: 0.1, maxValue: 0.15, isPercentage: true, weight: 5, rarity: 3, groups: [EAffixGroup.Universal], wuxing: EWuxing.Shui },
    
        // // 火系词缀
        // { type: EAffixType.Huo_DamageToBurning, minValue: 0.15, maxValue: 0.3, isPercentage: true, weight: 8, rarity: 2, groups: [EAffixGroup.Universal], wuxing: EWuxing.Huo },
        // { type: EAffixType.Huo_DamageToMetalEnemy, minValue: 0.05, maxValue: 0.1, isPercentage: true, weight: 6, rarity: 2, groups: [EAffixGroup.Universal], wuxing: EWuxing.Huo },
        // { type: EAffixType.Huo_SunnyDaySkillDamage, minValue: 0.1, maxValue: 0.15, isPercentage: true, weight: 5, rarity: 3, groups: [EAffixGroup.Universal], wuxing: EWuxing.Huo },
    
        // // 土系词缀
        // { type: EAffixType.Tu_DamageToStunned, minValue: 0.15, maxValue: 0.3, isPercentage: true, weight: 8, rarity: 2, groups: [EAffixGroup.Universal], wuxing: EWuxing.Tu },
        // { type: EAffixType.Tu_DamageToWaterEnemy, minValue: 0.05, maxValue: 0.1, isPercentage: true, weight: 6, rarity: 2, groups: [EAffixGroup.Universal], wuxing: EWuxing.Tu },
        // { type: EAffixType.Tu_WindDaySkillDamage, minValue: 0.1, maxValue: 0.15, isPercentage: true, weight: 5, rarity: 3, groups: [EAffixGroup.Universal], wuxing: EWuxing.Tu },
    
        // // 通用五行词缀
        // { type: EAffixType.WallHPFullAttack, minValue: 0.05, maxValue: 0.1, isPercentage: true, weight: 5, rarity: 2, groups: [EAffixGroup.Universal] },
        // { type: EAffixType.WallHPFullAttackSpeed, minValue: 0.05, maxValue: 0.1, isPercentage: true, weight: 5, rarity: 2, groups: [EAffixGroup.Universal] },
        // { type: EAffixType.WallHPLowAttack, minValue: 0.05, maxValue: 0.1, isPercentage: true, weight: 5, rarity: 2, groups: [EAffixGroup.Universal] },
        // { type: EAffixType.WallHPLowAttackSpeed, minValue: 0.05, maxValue: 0.1, isPercentage: true, weight: 5, rarity: 2, groups: [EAffixGroup.Universal] },
        // { type: EAffixType.DamageIncreaseToElite, minValue: 0.2, maxValue: 0.3, isPercentage: true, weight: 4, rarity: 3, groups: [EAffixGroup.Universal] },
        // { type: EAffixType.DamageIncreaseToGeneral, minValue: 0.2, maxValue: 0.3, isPercentage: true, weight: 4, rarity: 3, groups: [EAffixGroup.Universal] },
        // { type: EAffixType.DamageIncreaseToSoldier, minValue: 0.2, maxValue: 0.3, isPercentage: true, weight: 4, rarity: 3, groups: [EAffixGroup.Universal] },
        // { type: EAffixType.DamageIncreaseToHighHP, minValue: 0.15, maxValue: 0.25, isPercentage: true, weight: 5, rarity: 2, groups: [EAffixGroup.Universal] },
        // { type: EAffixType.DamageIncreaseToLowHP, minValue: 0.15, maxValue: 0.25, isPercentage: true, weight: 5, rarity: 2, groups: [EAffixGroup.Universal] },
        // { type: EAffixType.DamageIncreaseToCCTarget, minValue: 0.1, maxValue: 0.2, isPercentage: true, weight: 6, rarity: 2, groups: [EAffixGroup.Universal] },
        // { type: EAffixType.RageRegen, minValue: 1, maxValue: 1, isPercentage: false, weight: 3, rarity: 4, groups: [EAffixGroup.Universal] },
        // { type: EAffixType.DamageIncrease25Strength, minValue: 0.25, maxValue: 0.25, isPercentage: true, weight: 5, rarity: 2, groups: [EAffixGroup.Universal] },
        // { type: EAffixType.DamageIncrease25Agility, minValue: 0.25, maxValue: 0.25, isPercentage: true, weight: 5, rarity: 2, groups: [EAffixGroup.Universal] },
        // { type: EAffixType.DamageIncrease25Intelligence, minValue: 0.25, maxValue: 0.25, isPercentage: true, weight: 5, rarity: 2, groups: [EAffixGroup.Universal] },

}